<div>
	<!-- widget content -->
	<div class="widget-body">

		<form action="" method="post" id="checkout-form" class="smart-form">
			<header>
				<h2>
					业务系统新增
					<button class="close" data-dismiss="modal">x</button>
				</h2>

			</header>
			<fieldset>
				<div id="dialog-alert"></div>
				<div class="row">
					<label class="label col col-3"><label style="color: red">*</label>系统名称</label>
					<section class="col col-8">
						<label class="input"> <input type="text" name="name"
							placeholder=" 输入系统名称" class="required ">
						</label>
					</section>
				</div>
				<div class="row">
					<label class="label col col-3"><label style="color: red">*</label>业务系统描述</label>
					<section class="col col-8">
						<label class="textarea"> <textarea rows="3" name="description"
								class="custom-scroll required" placeholder=" 在此对此系统进行描述"></textarea>
						</label>
					</section>
				</div>
			</fieldset>
		</form>
	</div>
	<!-- end widget content -->

</div>
<div class="modal-footer">

	<button type="button" class="btn btn-default btn-sm"
		data-dismiss="modal">取消</button>
	<button type="submit" class="btn btn-primary btn-sm" id="submitbtn">
		保存</button>
</div>

<script>
    pageSetUp();
    var pagefunction = function() {
        var errorClass = 'invalid';
        var errorElement = 'em';
        var option={ 
            errorClass: errorClass,
            errorElement:errorElement,
            highlight: function(element) {
                $(element).parent().removeClass('state-success').addClass("state-error");
                $(element).removeClass('valid');
            },
            unhighlight: function(element) {
                $(element).parent().removeClass("state-error").addClass('state-success');
                $(element).addClass('valid');

            },
            // Rules for form validation
            // Messages for form validation
            messages:{
                name : {
                    required : '请输入业务系统名称'
                },
                description : {
                    required : '请输入业务系统描述'
                }
            },
            errorPlacement : function(error, element) {
                if($(element).next("div").hasClass("tooltip")) {
                    $(element).attr("data-original-title", $(error).text()).tooltip("show");
                } else {
                    $(element).attr("title",
                            $(error).text()).tooltip("show");
                }
            },
            submitHandler:function(form){
            	//在这里生成需要提交的json数据
            	var data=$('#checkout-form').serializeArray();
            	var jsonData=arrayToString(data);
            	//在这里调用ajax方法提交
            	sendPost("/upm_manager/v1.0/business_systems", postSuccess,DialogAlert, jsonData, null);
            }
        };
        $('#checkout-form').validate(option);
    };
    loadScript("js/plugin/jquery-form/jquery-form.min.js", pagefunction);
    $('#submitbtn').click(function() {
    	DialogAlertClear();
    	$('#checkout-form').submit();
    });
    function postSuccess(data){
    	//提交成功的方法
    	$("#addModal").modal('toggle');
    	sendGet("/upm_manager/v1.0/business_systems",reloadGrid,ListAlert,null);
    }
</script>